package org.video.common.data.model.areas.imp;

import org.video.common.data.model.areas.IAreaData;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;


public class AreaDataImp implements IAreaData {

    protected String areaName;
    private Map<String, List<Object>> areaSheet = new HashMap<String, List<Object>>();

    @Override
    public String getAreaName() {
        return this.areaName;
    }

    @Override
    public Map<String, List<Object>> getAreaSheet() {
        return areaSheet;
    }

    @Override
    public List<Object> getSheetColumn(int index) {
        return (List<Object>) areaSheet.values().toArray()[index];
    }

    @Override
    public List<Object> getSheetColumn(String name) {
        return areaSheet.get(name);
    }

    @Override
    public List getSheetRow(int index) {
        List<Object> row = new LinkedList<Object>();
        for (List<Object> item: areaSheet.values())
        row.add(item.get(index));
        return row;
    }

    public void addSheetElement(String _name, List _data){
        areaSheet.put(_name, _data);
    }


}
